﻿using System.Diagnostics;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;

public class CfgMenus
{
    [MenuItem("== Paradogs2 ==/生成配置表")]
    private static void buildCfg()
    {
        // 创建一个 Process 对象
        Process process = new Process();
        // 设置要启动的文件的信息
        Debug.Log(Application.dataPath);
        process.StartInfo.FileName = $"{Application.dataPath}/Paradogs2SDK/Luban/gen-luban.bat";
        // // 设置工作目录（可选）
        process.StartInfo.WorkingDirectory = $"{Application.dataPath}/Paradogs2SDK/Luban";
        // 指示使用 Shell 执行命令
        process.StartInfo.UseShellExecute = true;
        try
        {
            // 启动进程
            process.Start();
        }
        catch (System.Exception e)
        {
            Debug.LogError($"Failed to start the.bat file: {e.Message}, bat: {process.StartInfo.FileName}");
        }
    }
}